package Jackson;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Xiang on 2014/8/9.
 */
public class MyValue {
    public String name;
    public int age;

    public MyValue(String name,int age) {
        this.name = name;
        this.age = age;
    }

    public static void main(String[] args) throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();
        List<MyValue> list = new ArrayList<MyValue>();
        list.add(new MyValue("First", 1));
        list.add(new MyValue("Second", 2));
        list.add(new MyValue("Third", 3));
        String jsonString = mapper.writeValueAsString(list);
        System.out.print("Test");
        System.out.print(jsonString);
    }

}
